#ifndef ATHLETEMODEL_H
#define ATHLETEMODEL_H

#include <QSqlTableModel>
#include "systemcontroller.h"

class AthleteModel : public QSqlTableModel 
{
public:
    AthleteModel(SystemController *controller, QObject * parent = 0, QSqlDatabase db = QSqlDatabase());
    ~AthleteModel();
    //Public Static const
    static const int ID_COLUMN = 0;
    static const int NAME_COLUMN = 1;
    static const int FIRST_NAME_COLUMN = 2;
    static const int BIRTH_DATE_COLUMN = 3;
    static const int GENDER_COLUMN = 4;
    static const int PHONE_COLUMN = 5;
    static const int MOBILE_COLUMN = 6;
    static const int MAIL_COLUMN = 7;
    static const int CID_COLUMN =8;

    //Overwritten functions
    bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
    QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const;

protected:
    QString selectStatement() const;

private:
    SystemController *systemController;
    QWidget *parentWidget;

    int dateOverdue (QString dateString) const;
};

#endif // ATHLETEMODEL_H
